﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Crossroad.Utils.Extensions
{
    public static class ByteExt
    {
        /// <summary>
        /// 转换枚举
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="input"></param>
        /// <returns></returns>
        public static T ToEnum<T>(this byte input)
        {
            var type = typeof(T);

            return (T)Enum.ToObject(type, Convert.ToInt32(input));
        }
    }
}
